package pro;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

public class BaseDriver {
	public  AndroidDriver<AndroidElement>  driver=null;
	String urlStr = "http://127.0.0.1:4723/wd/hub";
	@BeforeClass
	public void initApp() throws MalformedURLException {
		URL url = new URL(urlStr);
		DesiredCapabilities cap=new DesiredCapabilities();
		
		cap.setCapability("platformName", "Android");
		cap.setCapability("deviceName", "127.0.0.1:62001");
		cap.setCapability("appPackage", "com.lyc.cashbook");
		cap.setCapability("appActivity", ".ui.MainActivity");
		driver=new AndroidDriver<AndroidElement>(url,cap);
		
	}
	
	@AfterMethod
	public void quitApp() {
		if(driver!=null) {
			driver.quit();
		}
		
	}

}
